<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>paiTa</title>
    <script src="../UI/jquery/jquery-3.3.1.min.js"></script>
    <style>
        li{
            list-style-type: none;
            float: left;
        }
        .wrap{
            border:1px solid red;
            width: 225px;
            height: 110px;
            overflow:hidden;
        }
    </style>
</head>

<body>
    <div class="wrap">
        <ul>
            <li><button>1</button></li>
            <li><button>2</button></li>
            <li><button>3</button></li>
            <li><button>4</button></li>
            <li><button>5</button></li>
        </ul>
        <div class="pic">
            <div><a href=""><img src="images/c.png" alt=""></a></div>
            <div><a href=""><img src="images/h.png" alt=""></a></div>
            <div><a href=""><img src="images/l.png" alt=""></a></div>
            <div><a href=""><img src="images/m.png" alt=""></a></div>
            <div><a href=""><img src="images/z.png" alt=""></a></div>
        </div>
    </div>
    <script>
        $(function () {
            // 1. 隐式迭代 给所有的按钮都绑定了点击事件
            $("li").click(function () {
                // 2. 当前的元素变化背景颜色    // 3. 其余的兄弟去掉背景颜色 隐式迭代
                $(this).css("background", "pink").siblings("li").css("background", "");
                const index = $(this).index();
                $(".pic div").eq(index).show().siblings().hide();
            });
        })
    </script>
</body>

</html>